<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:eibus="http://schemas.cordys.com/eibus" onapplicationready="initGlobals();initialize()" >
    <head>
        <title>Crom Configuration</title>
		<script src="/cordys/wcp/application.js" >
		</script>
		<style>
			input{font-size:11; font-family:verdana;}
			label{font-size:11; font-family:verdana;}    
		</style>		

    <script	src="/cordys/wcp/admin/behavior/applicationconnector.js"></script>
    <script language="JScript">
    	/**
         * Initialize global varibales.
         */
    	function initGlobals()
    	{
			VARS = { "DOMAIN_PACKAGE" : document.getElementById("txtDomainPackage"),
					"DB_PACKAGE" : document.getElementById("txtDBPackage"),
					"DISABLED" : document.getElementById("txtDisabled")
			};
    	}
	
        /**
         * This method creates the needed configuration for the connector
         *
         * @param xmlConfig The configuration-XML.
		 *
		 * @return true if the checks were successfull and the configuration is finished.
		 *         false if the user still has to fill the mandatory fields.
         */
        function createConnectorConfiguration(xmlConfig)
        {
            var bReturn = true;
            var xmlDoc = xmlConfig.ownerDocument;
            var nConfig = xmlDoc.createElement("Configuration");

			var nNode = xmlDoc.createElement("domainPackage");
			cordys.setTextContent(nNode, VARS.DOMAIN_PACKAGE.value);
			nConfig.appendChild(nNode);

			var nNode = xmlDoc.createElement("dbPackage");
			cordys.setTextContent(nNode, VARS.DB_PACKAGE.value);
			nConfig.appendChild(nNode);

			var nNode = xmlDoc.createElement("disabled");
			var value = VARS.DISABLED.checked ? "true" : "false";
			cordys.setTextContent(nNode, value);
			nConfig.appendChild(nNode);

            xmlConfig.appendChild(nConfig);

            return bReturn;
        }//createConnectorConfiguration

        /**
         * This method fills the inputfields based on the XML.
         *
         * @param xmlConfig The configuration-XML.
         */
        function fillInPropertyScreen(xmlConfig)
        {
			var nNode = cordys.selectXMLNode(xmlConfig, ".//domainPackage");
            if (nNode != null)
            {
            	VARS.DOMAIN_PACKAGE.value = cordys.getTextContent(nNode);
            }

            var nNode = cordys.selectXMLNode(xmlConfig, ".//dbPackage");
            if (nNode != null)
            {
            	VARS.DB_PACKAGE.value = cordys.getTextContent(nNode);
            }

            var nNode = cordys.selectXMLNode(xmlConfig, ".//disabled");
            if (nNode != null)
            {
				var value = cordys.getTextContent(nNode);
            	VARS.DISABLED.checked = (value=="true");
            }

			cordys.addDOMListener(VARS.DOMAIN_PACKAGE, "onchange", raiseConfigurationChanges);
			cordys.addDOMListener(VARS.DB_PACKAGE, "onchange", raiseConfigurationChanges);
			cordys.addDOMListener(VARS.DISABLED, "onchange", raiseConfigurationChanges);
        }
		     
        /**
         * This event is raised when a property is changed and will inform
         * the parent UI that an update is needed.
         */
		function raiseConfigurationChanges()
        {
            if (!application.container.isWizardContainer)
			{
                system.windows.servicepropertiesPage_SystemResourceManager.configurationChanged();
			}
        }
    </script>
	</head>
    <body>
        <table width="100%" style="border: 1px solid black;" cellspacing="0" cellpadding="5">
            <tr class="medium">
                <td colspan="2" align="center">
                    <STRONG>Crom Configuration</STRONG>
                </td>
            </tr>
            <tr>
                <td width="50%" align="right">
                    Java package containing Domain classes
                </td>
                <td  align="left">
                    <input type="text" style="width:300px" id="txtDomainPackage" class="input"  value=""/>
                </td>
            </tr>
            <tr>
                <td width="50%" align="right">
                    Java package containing database classes
                </td>
                <td  align="left">
                    <input type="text" style="width:300px" id="txtDBPackage" class="input"  value=""/>
                </td>
            </tr>
            <tr>
                <td width="50%" align="right">
                    Disable crom (no initializations and checks are done during startup)
                </td>
                <td  align="left">
                    <input type="checkbox" style="width:300px" id="txtDisabled" class="input"  value="false"/>
                </td>
            </tr>
		</table>
    </body>
</html>
